#ifndef __SERIAL_H__
#define __SERIAL_H__		1

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define SERIAL_OPEN_RETRY_TIMES		3
#define SERIAL_OPEN_RETRY_DELAY_TIME	1*1000*1000

typedef struct _SerialConfig {
        int baudrate;
        int databits;
        int parity;
        int stopbit;
        int hw_flowctrl;
        int sw_flowctrl;
}SerialConfig;

/* serial.c */
extern int serial_init(unsigned char *fn);
extern int serial_close(int fd);
extern int serial_write(int fd, const void *buf, size_t count);
extern int serial_read(int fd,void *buf,size_t count,unsigned int cmd_tv_ms);
extern int serial_read_once(int fd,void *buf,size_t count,unsigned int cmd_tv_ms);

#endif		// #ifndef __SERIAL_H__
